import torch
import torch.nn as nn

a = torch.tensor([[[0.36, 0.26, 0.713],[0.94, 0.455, 0.946],[0.327, 0.118, 0.9429]]], dtype=torch.float32)
b = torch.tensor([[[0.36, 0.26, 0.713]]], dtype=torch.float32)

c = torch.randn((2,4, 3))


d = torch.randn((4, 3))
e = d.view(1, 1, -1)
print(b.shape)

rnn = nn.GRU(3, 4, 1)
input = c
h0 = torch.randn(1, 4, 4)
output, hn = rnn(input, h0)
for k,v in rnn.named_parameters():
    print(k, v.shape)
m, f = d.size()[:2]
w = c.view(1,2,1,-1).transpose(1,2)
position = torch.arange(2, 10,  2, dtype=torch.float).unsqueeze(1)
print(position)
scores = torch.randint(200,[3,4])
print(scores)
mask=torch.randint(2,[3,4])
print(mask)
scores = scores.masked_fill(mask == 1, -1e9)
print(scores)

input_ids = torch.tensor([[10, 20, 30, 0, 0],
             [40, 50, 60, 70, 80]])
padding_mask = input_ids != 0
print(padding_mask)